import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '标题',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '类型',
    align: "center",
    dataIndex: 'type_dictText'
  },
  {
    title: '值',
    align: "center",
    dataIndex: 'value'
  },
  {
    title: '排序',
    align: "center",
    sorter: true,
    dataIndex: 'sorti'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "标题",
    field: 'title',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "类型",
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "type_commission"
    },
    //colProps: {span: 6},
  },
  {
    label: "值",
    field: 'value',
    component: 'InputNumber',
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '标题',
    field: 'title',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入标题!' },
      ];
    },
  },
  {
    label: '类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "type_commission",
      type: "radio"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入类型!' },
      ];
    },
  },
  {
    label: '值',
    field: 'value',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入值!' },
      ];
    },
  },
  {
    label: '排序',
    field: 'sorti',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入排序!' },
      ];
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  title: { title: '标题', order: 0, view: 'text', type: 'string', },
  type: { title: '类型', order: 1, view: 'radio', type: 'string', dictCode: 'type_commission', },
  value: { title: '值', order: 2, view: 'number', type: 'number', },
  sorti: { title: '排序', order: 3, view: 'number', type: 'number', },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}